<template>
  <div>
    <input
      type="text"
      :value="modelValue.name"
      @input="inputChange($event, 'name')"
    />
    <input
      type="text"
      :value="modelValue.age"
      @input="inputChange($event, 'age')"
    />
  </div>
</template>
<script>
export default {
  props: ["modelValue"],
  emits: ["update:modelValue"],
  data() {
    return {};
  },
  computed: {},
  methods: {
    inputChange(e, field) {
      this.$emit("update:modelValue", {
        ...this.modelValue,
        [field]: e.target.value,
      });
    },
  },
};
</script>
